package com.dianhun.cn.pojo;

import com.dianhun.cn.anno.MyValidated;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.NotBlank;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

/**
 * @author cyt
 * @create 2020-08-26 10:40
 */
@Accessors(chain = true)
@Data
public class Person {
    @NotNull(groups = PersonUpdateGroup.class)
    private String name;
    @NotBlank(groups = {PersonInsertGroup.class, PersonUpdateGroup.class})
    private String address;

    @NotNull(groups = PersonInsertGroup.class)
    @Min(value = 4,groups = PersonInsertGroup.class)
    private Integer age;

    @MyValidated(message = "message")
    private String test;

    public interface PersonInsertGroup {
    }
    public interface PersonUpdateGroup {
    }
}
